package opt;

import org.junit.Test;

import com.alibaba.fastjson.JSONObject;

public class JSONTest {
	
	@Test
	public void putObjectTest() {
		JSONObject jsonObject = new JSONObject();
		Person me = new Person("me");
		me.setB(new Person("B"));
		jsonObject.put("key", me);
		System.out.println(jsonObject.toJSONString());
	}
}

class Person{
	String name;
	Person b;
	public Person(String name) {
		this.name = name;
	}
	public String getNNN() {
		return "NNN";
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Person getB() {
		return b;
	}
	public void setB(Person b) {
		this.b = b;
	}
}